module.exports = function bodyParser() {
  // 插件都是一个个的函数
  return async function (ctx, next) {
    ctx.request.body = await new Promise((resolve, reject) => {
      const arr = [];
      ctx.req.on("data", function (chunk) {
        arr.push(chunk);
      });
      ctx.req.on("end", function () {
        resolve(Buffer.concat(arr).toString());
      });
    });

    
    return next();
  };
};
